export default {
  //存session
  setContextData: function (key, value) {
    if (typeof value == 'string') {
      sessionStorage.setItem(key, value)
    } else {
      sessionStorage.setItem(key, JSON.stringify(value))
    }
  },
  //取session
  getContextData: function (key) {
    const str = sessionStorage.getItem(key)
    if (typeof str == 'string') {
      try {
        return JSON.parse(str)
      } catch (e) {
        return str
      }
    }
    return
  }
}
